package com.flow.engine.enums.standard;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author ly163
 */

@Getter
@AllArgsConstructor
public enum ApprovalState {



    PASS(1,"审批通过"),
    // 在选择多个审批的情况下，只要其中一个审批通过，就通过下 其他则是这个状态
    _PASS(2,"审批通过"),
    REJECT(3,"拒绝"),
    _REJECT(4,"拒绝"),
    WAITING(5,"待审核");

    @EnumValue
    private final Integer code;

    @JsonValue
    private final String msg;

    public static ApprovalState get(int code) {
        return Arrays.stream(ApprovalState.values())
                .filter(serverTypeEnum -> serverTypeEnum.getCode() == code)
                .findFirst()
                .orElse(null);
    }

}
